import React from 'react'
import {withRouter} from 'react-router-dom'

const ZanItem = props => {
    const {
        Hfavatar,
        Hfname,
        Zant,
        Htid,
    } = props.zan

    const avatar = <div style={{marginRight: '8px'}}>
        <img src={Hfavatar} alt='' className='my-topic-item-avatar'/>
    </div>
    const name = <p style={{marginBottom: '4px',}}>{Hfname}</p>
    const date = <p className='gray-text' style={{marginBottom: '10px',}}>{props.formatDate(Zant)}</p>
    return <div
        className='my-topic-zan-ctn flex'
        onClick={() => props.history.push(`../${props.zanType}/${Htid}`)}
    >
        {avatar}
        <div>
            {name}
            {date}
            <p style={{fontWeight: 'bold'}}>赞了您</p>
        </div>
    </div>
}

export default withRouter(ZanItem)
